from django.contrib import admin

from .models import Book, Author

# admin.site.index_title = "index_title"
# admin.site.site_title = "site_title"
# admin.site.site_header="site_header"
admin.site.index_title = "图书管理系统首页"
admin.site.site_title = "图书管理页"
admin.site.site_header = "图书管理"


# Register your models here.

class BookAdmin(admin.ModelAdmin):
    list_display = ['id', 'name', 'price', 'isbn_no']  # 展示时候属性
    ordering = ['-price', 'id']
    list_per_page = 5
    fields = ['name', 'price', 'isbn_no']  # 增加,修改时候的属性



admin.site.register(Book, BookAdmin)


# 第二种注册方式

@admin.register(Author)
class AuthorAdmin(admin.ModelAdmin):
    list_display = ['id', 'name', 'sex']  # 是模型中的属性
    search_fields = ['name', 'sex']
